<?php
function smarty_modifier_collect() {
	$args = func_get_args();
	$html="";
	$callBack = empty($args[3]) ? 'collectBack' : $args[3];
	$isCanel = empty($args[4]) ? 0 : 1;
	if(count($args)>=3){
		$kpdo = getkpdo();
		$sql = "select count(*) c from `collect` where uid=? and `type`=? and `typefield`=? and objid=? ";
		$c =null;
		$c = $kpdo->one($sql,array($_SESSION['NB_uid'],$args[0],$args[2],$args[1]));
		if($c){
			$html.="<a class='collect_kannb_{$args[1]} ui_fav ui_has_fav' id='collect_kannb' data-value=1 href=javascript:albumCollect('".$args[0]."','".$args[1]."','".$args[2]."',$callBack); class='ui_fav ui_has_fav'><i class='iconfont'>&#xf01e;</i>已收藏</a>";
		}else{
			$html.="<a class='collect_kannb_{$args[1]} ui_fav' id='collect_kannb' data-value=0 href=javascript:albumCollect('".$args[0]."','".$args[1]."','".$args[2]."',$callBack);><i class='iconfont'>&#xe616;</i>收藏</a>";
		}

	} else {
		$html.="收藏";
	}
	return $html;
}
